<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <a href="https://chat.deepseek.com/">跳转</a>
    <button>按钮</button>
    <script>
        function fn(){
            alert('点击了')
        }
        const btn = document.querySelector('button')
        btn.addEventListener('click',fn)
        btn.removeEventListener('click',fn)
        //阻止元素默认行为
          const a = document.querySelector('a')
          a.addEventListener('click',function(e){
          e.preventDefault()
          })
    </script>
</body>
</html>